package com.kaizzi.data.jdl.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kaizzi.data.common.been.TempBeen;
import com.kaizzi.data.common.been.TempBehavior;
import com.kaizzi.data.jdl.entity.MotionClocks;
import com.kaizzi.data.jdl.mapper.MotionClocksMapper;
import com.kaizzi.data.jdl.service.JdlNumService;
import com.kaizzi.data.jdl.service.MotionClocksService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Kzen
 * @Description description
 * @date 2020/9/11
 */
@Service
@Slf4j
public class MotionClocksServiceImpl extends ServiceImpl<MotionClocksMapper, MotionClocks> implements MotionClocksService {
    @Resource
    private MotionClocksMapper motionClocksMapper;
    @Resource
    private JdlNumService jdlNumService;

    @Override
    @DS("jdl_view")
    public long getClockInCount(String startDate,String endDate) {
        Long clockInCount = motionClocksMapper.getClockInCount(startDate, endDate);
        if (clockInCount == null){
            return 0;
        }
        return clockInCount;
    }

    @Override
    @DS("jdl_view")
    public long getClockInUser(String startDate, String endDate) {
        Long clockInUser = motionClocksMapper.getClockInUser(startDate, endDate);
        return jdlNumService.transNum(clockInUser);
    }

    @Override
    @DS("jdl_view")
    public long getClockInTrend(String startDate, String endDate) {
        Long clockInTrend = motionClocksMapper.getClockInTrend(startDate, endDate);
        return jdlNumService.transNum(clockInTrend);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getClockInSportType(String startDate, String endDate) {
        return motionClocksMapper.getClockInSportType(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getClockInArea(String startDate, String endDate) {
        return motionClocksMapper.getClockInArea(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public long getClockInArea4(String startDate, String endDate) {
        Long clockInArea4 = motionClocksMapper.getClockInArea4(startDate, endDate);
        return jdlNumService.transNum(clockInArea4);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getClockInGender(String startDate, String endDate) {
        return motionClocksMapper.getClockInGender(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getClockInAge(String startDate, String endDate) {
        return motionClocksMapper.getClockInAge(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getYfFission(String startDate, String endDate) {
        return motionClocksMapper.getYfFission(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getPublic(String startDate, String endDate) {
        return motionClocksMapper.getPublic(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getYfKoc(String startDate, String endDate) {
        return motionClocksMapper.getYfKoc(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getMarathon(String startDate, String endDate) {
        return motionClocksMapper.getMarathon(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBeen> getWes(String startDate, String endDate) {
        return motionClocksMapper.getWes(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBehavior> getYfFission2(String startDate, String endDate) {
        return motionClocksMapper.getYfFission2(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBehavior> getPublic2(String startDate, String endDate) {
        return motionClocksMapper.getPublic2(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBehavior> getYfKoc2(String startDate, String endDate) {
        return motionClocksMapper.getYfKoc2(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBehavior> getMarathon2(String startDate, String endDate) {
        return motionClocksMapper.getMarathon2(startDate,endDate);
    }

    @Override
    @DS("jdl_view")
    public List<TempBehavior> getWes2(String startDate, String endDate) {
        return motionClocksMapper.getWes2(startDate,endDate);
    }
}
